
package flc.ast.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.blankj.utilcode.util.CollectionUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.lxj.xpopup.core.AttachPopupView;

import flc.ast.R;
import flc.ast.adapter.RateAdapter;
import stark.common.api.StkResApi;
import stark.common.base.IReqRetCallback;
import stark.common.bean.StkExchangeRateBean;
import stark.common.bean.StkExchangeRateList;

public class CalTypeDialog extends AttachPopupView implements View.OnClickListener {

    private TextView tvForwardCal, tvBackwardCal;

    public CalTypeDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_cal_type;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        initView();
    }

    protected void initView() {
        tvForwardCal = findViewById(R.id.tvForwardCal);
        tvBackwardCal = findViewById(R.id.tvBackwardCal);

        tvForwardCal.setOnClickListener(this);
        tvBackwardCal.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tvForwardCal://向前推算
                if (listener != null) {
                    listener.click(0);
                }
                break;
            case R.id.tvBackwardCal://向后推算
                if (listener != null) {
                    listener.click(1);
                }
                break;
            default:
                break;
        }
    }

    private Ilistener listener;

    public void setListener(Ilistener listener) {
        this.listener = listener;
    }

    public interface Ilistener {
        void click(int pos);
    }

}
